Collimator
Link to Google Drive
Link to all documents regarding BSM2 model and wastewater treatment plant
Link to notebook related to Collimator project
- Collimator to TDEngine notebook
- To displace collimator's result and matlab's result on Grafana.
- matlab_output_cross_reference.csv (old filename: matlab_output_column_name.csv) contains the names of column in the matlab output file that are corresponding to the 16 variables of each submodel.
- collimator_cross_reference_2022_12_08.csv (old filename: collimator_output_column_name_xxxx_xx_xx) contains the names of column in the colimator output file that created on 2022-12-08 or after that are corresponding to the 16 variables of each submodel.
- The cross reference csv for different timestamp was created to match the column name of the 16 variables from the collimator output files that were created before 2022-12-08 because the blocks were renamed.
- Compare the physical model results with hybrid model (bioreactor_1 AI) results
Model descriptions inside BSM2 project
| Name | Type | Description |
|---|---|---|
| BSM2_Develop | Model | BSM2 developing model. The current working version is the BSM2 physical model that uses python script block for flow combiner and Bioreactor_with_Integrator_as_a_Delay_Block submodels are used for bioreactor 1, 2 ,3 ,4, and 5 in the activated sludge. |
| BSM2_with_Bioreact_1_AI | Model | BSM2 with activated sludge (AS) bioreactor 1 is replaced with a time series AI model. |
| BSM2_Physical_Model | Model | BSM2 model created based on BSM2 Matlab model. Bioreactor_with_Integrator_as_a_Delay_Block submodels were used for bioreactors 1, 2, 3, 4, and 5 in the activated sludge |
| outdatedBSM2_with_the_First_Bioreactor_Block(incorrect) | Model | BSM2 model with the old bioreactor submodels for bioreactor 1, 2, 3, 4, and 5 in the activated sludge. |
| Test_PyTorch_Model_Loading | Model | Testing pytorch model loading |
| Test_Delay_Block | Model | Testing the unit delay block by inputting different pulse width and period. |
| Test_Delay_Block_for_TS | Model | Testing the delay block for time series model |
| Test_Bioreactor_1_AI | Model | Testing time series bioreactor 1 AI model |
| Test_Mux_Block | Model | Testing the mux block |
| Test_Bioreactor_with_Integrator_as_a_Delay_Block_Submodel | Model | Testing the Bioreactor with Integrator as a delay block submodel |
| Test_Bioreactor_with_Integrator_as_a_Delay_Block_and_So_Control_Submodels | Model | Testing the Bioreactor with Integrator as a Delay Block and So Control submodels |
| Bioreactor_with_Unit_Delay_as_a_Delay_Block | Submodel | Physical model of the bioreactor in the activated sludge. The unit delay block is used to break the algebraic loop when reading the Kla value back from the So control submodel. |
| Bioreactor_with_Integrator_as_a_Delay_Block | Submodel | Physical model of the bioreactor in the activated sludge. The integrator block is used to break the algebraic loop when reading the Kla value back from the So control submodel. |
| Bioreactor_1_py | Submodel | Time series model trained with bioreactor 1 input and output values. |
| T_Model_Block | Submodel | Temperature model block. User can choose between using ODE to get the temperature output or setting the output temperature to be equal to the input temperature. Declare Tmodel value to be more than 0.5 to use the ODE to get the output temperature. |
| ODE_Mass_Balance_Block | Submodel | Generic ODE equation block for BSM2 variables. The block can be used to get soluble and particulate concentrations of different sub-processes. |
| TS_12_Timesteps | Submodel | Creating an input array for time series model. The array contains the current and the previous 11-time steps value. If the current time step is less than 11, the variable's initial value will be used instead. |
| So_Control | Submodel | Oxygen concentration control block |
Different Saved versions inside BSM2 project
- To access different saved version history of the model
- click on the version history tab on the upper right corner
- click on the version history tab on the upper right corner
| Version History | Model/Submodel | Description |
|---|---|---|
| pH_solver_ODE_for_7variables | BSM2_Develop | The simulation was aborted due to time out. Unlike the previous version, all 7 variables inside pH solver block were solved using ODE. |
| pH_solver_for_ODE_only_one_variable | BSM2_Develop | The simulation was able to be completed. However, the outputs were different from Matlab outputs. In attempt to work around algebraic loop found in BSM2_model_problem_with_AlgebraicLoop, I converted the Sh2_solver and pH_solver from DAE to ODE. In this version, only Sh2 and H_ion ( 1 out of 7 variables) in pH ODE were solved. The other 6 variables were solved based on the H_ion. |
| completed_model_old_SO4_control_block | BSM2_Develop | First version of the completed BSM2 model with an old SO4 control block for bioreactor 4 and the first version of the bioreactor submodel. |
| new_SO4_control_block_new_bioreactor_1 | BSM2_Develop | Modified bioreactor 1 block and SO4 control block. |
| replace_all_bioreactors_with_new_one | BSM2_Develop | Replaced bioreactor 1,2, 3, 4, and 5 with the modified bioreactors from the previous version (second version of bioreactor) |
| version_before_replacing_bioreactor_submodel | BSM2_Develop | bioreactor 1, 2, 3, 4, and 5 with modified bioreactor models using the old submodel block |
| version_after_replacing_new_bioreactor_submodels | BSM2_Develop | Replaced bioreactor 1, 2, and 3 with Bioreactor_with_Unit_Delay_as_a_Delay_Block submodel (third version of bioreactor) |
| bioreactor_without_delay_block_for_1,2,3,and5 | BSM2_Develop | Replaced bioreactor 1, 2, 3, and 5 with Bioreactor_without_delay_block. Only bioreactor 4 contains the unit delay |
| bioreactor_with_intergrator_delay | BSM2_Develop | Replaced bioreactor 1, 2, 3, 4, and 5 with Bioreactor_with_Integrator_as_a_Delay_Block submodels |
| bioreactor_with_intergrator_delay_new_flowcombiner | BSM2_Develop | Previous version with modified flowcombiner blocks |
| first_physical_model | BSM2_Develop | The first version of the physical model before replacing the bioreactor 1 with AI model |
| with_Bioreactor_1_AI | BSM2_Develop | Replaced bioreactor 1 block with Bioreactor_1_py submodel. The bioreactor_1_py block has a 'soluble-particulate-t-TSTPlus-01-11-23 version. |
| Physical model | BSM2_Develop | The most up to date version of the physical model |
| soluble-particulate-t-TSTPlus-01-11-23 | Bioreactor_1_py | Use this version to load soluble-particulate-t-TSTPlus-01-11-23.pkl model |
| soluble-particulate-t-inceptionTimePlus-01-11-23 | Bioreactor_1_py | Use this version to load soluble-particulate-t-inceptionTimePlus-01-11-23.pkl model |
Input files
- We use the dryinfluent dataset from MATLAB as our input to the model. They are the same input dataset to the MATLAB model.
- The data has the time step of 15 min (0.0104 day).
Initialization Script
- We can import py script to install certain python package to be used in python script block before starting the simulation runs. For an example, if we need
pip install ipython tsai torch ipykernelbefore running BSM2_with_Bioreactor_1_AI model.